home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 223_01 / fa.c < prev    next >
Text File  |  1980-01-01  |  1KB  |  41 lines

  1.  
  2. /*    
  3. ** fa.c        File Append Program    by F.A.Scacchitti  7/17/86
  4. **
  5. **        Written in Small-C  Version 2.7 or later
  6. **
  7. **        Appends one files on to another
  8. **
  9. **    printf may be substituted for prntf (fas)
  10. */
  11.  
  12. #include <stdio.h>
  13.  
  14. int fdin, fdin2;
  15.  
  16. main(argc,argv) int argc; char *argv[]; {
  17.  
  18. FILE fdin, fdin2;
  19. char c;
  20.  
  21.    if (argc != 3) {
  22.       prntf("\nfa usage: fa <original file> <file to add> <CR>\n");
  23.       exit();
  24.    }
  25.    if((fdin = fopen(argv[1],"a")) == NULL) {
  26.       prntf("\nUnable to open file %s\n",argv[1]);
  27.       exit();
  28.    }
  29.    if((fdin2 = fopen(argv[2],"r")) == NULL) {
  30.       prntf("\nUnable to create file %s.\n",argv[2]);
  31.       exit();
  32.    }
  33.  
  34.    while((c = fgetc(fdin2)) != EOF)
  35.       fputc(c,fdin);
  36.  
  37.    fclose(fdin);
  38.    fclose(fdin2);
  39. }
  40.  
  41.